(function() {

    var utilNs = window.namespace('shchekoldin.util');

    utilNs.string = {

        /**
         * @param {String} text
         * @param {Object} data
         * @return {String}
         */
        format : function(text, data) {
            return text.replace(/\${(.*?)}/gim, function(value, p1) {
                var
                matchParts = p1.split('.'),
                result = data[matchParts[0]],
                i;

                for (i = 1; i < matchParts.length; ++i) {
                    if (result) {
                        result = result[matchParts[i]];
                    }
                }

                return result;
            });
        }

    };

})();
